package soundwave.com.demo.list;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;

import soundwave.com.demo.R;
import soundwave.com.demo.adpater.MessageList_adapert;
import soundwave.com.demo.test.Messagecontet_test;

/**
 * Created by xu on 2017/3/26.
 */

public class MessageList extends Activity {
    private ListView messagelist;
    private TextView back;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.message_list);
        messagelist= (ListView) findViewById(R.id.message);
        back= (TextView) findViewById(R.id.back);

        ArrayList<Messagecontet_test>messagecontent=new ArrayList<>();
        Messagecontet_test message=new Messagecontet_test();
        message.setNewsimg(R.mipmap.ic_launcher);
        message.setNewsname("");
        message.setData("");
        messagecontent.add(message);

        MessageList_adapert adapert=new MessageList_adapert(this,R.layout.message_listcontent,messagecontent);
        messagelist.setAdapter(adapert);
        adapert.notifyDataSetChanged();

        messagelist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {

            }
        });
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });


    }
}
